﻿#include "widget.h"
#include "ui_widget.h"


Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);
    this->myTimer=new QTimer(this);
    this->play();

}

Widget::~Widget()
{
    delete ui;
}

void Widget::play()
{

    myTimer->stop();
    ui->progressBar->setValue(0);
    ui->lcdNumber->setDigitCount(3);
    ui->lcdNumber->display(MAX_TIME);
    this->currentTime=MAX_TIME;

    ui->gameWidget->setAttribute(Qt::WA_TransparentForMouseEvents,true);
}
void Widget::on_startBtn_clicked()
{
    ui->gameWidget->setAttribute(Qt::WA_TransparentForMouseEvents,false);
    ui->gameWidget->newGame();
    myTimer->start(1000);
}

void Widget::on_stopBtn_clicked()
{
    myTimer->stop();
    ui->gameWidget->setAttribute(Qt::WA_TransparentForMouseEvents,true);
}
